package com.yjq.programmer.controller.app;

import com.yjq.programmer.dto.PageDTO;
import com.yjq.programmer.dto.ResponseDTO;
import com.yjq.programmer.dto.SingerDTO;
import com.yjq.programmer.service.ISingerService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 杨杨吖
 * @QQ 823208782
 * @WX yjqi12345678
 * @create 2022-11-30 11:41
 */
@RestController("AppSingerController")
@RequestMapping("/app/singer")
public class SingerController {

    @Resource
    private ISingerService singerService;

    /**
     * 小程序搜索歌手
     * @param singerDTO
     * @return
     */
    @PostMapping("/search")
    public ResponseDTO<List<SingerDTO>> appSearchSinger(@RequestBody SingerDTO singerDTO) {
        return singerService.searchSinger(singerDTO);
    }


    /**
     * 小程序根据id获取歌手数据
     * @param singerDTO
     * @return
     */
    @PostMapping("/getById")
    public ResponseDTO<SingerDTO> appGetSingerById(@RequestBody SingerDTO singerDTO) {
        return singerService.getSingerById(singerDTO);
    }

    /**
     * 小程序获取全部歌手数据
     * @return
     */
    @PostMapping("/all")
    public ResponseDTO<List<SingerDTO>> appGetAllSingerList() {
        return singerService.getAllSingerList();
    }



    /**
     * 小程序增加歌手浏览量
     * @param singerDTO
     * @return
     */
    @PostMapping("/addView")
    public ResponseDTO<Boolean> appAddSingerView(@RequestBody SingerDTO singerDTO) {
        return singerService.addSingerView(singerDTO);
    }

    /**
     * 小程序获取热门歌手数据
     * @param pageDTO
     * @return
     */
    @PostMapping("/hot")
    public ResponseDTO<List<SingerDTO>> appGetHotSingerList(@RequestBody PageDTO<SingerDTO> pageDTO) {
        return singerService.getHotSingerList(pageDTO);
    }
}
